import React from 'react';
import Charts from './charts';
import News from './news';
import './channe.css'
class Channe extends React.Component{
    state={
        ifChange:false
    }
    changeClickOne = () => {
        this.setState({ ifChange: false});
    }
    changeClick = () => {
        this.setState({ ifChange: true});
    }
    render(){
        return(
        
           <div >
              <div className='news-item' onClick={this.changeClickOne}><img src={require('../pages/images/标签.png') }class="nameb"/>养宠资讯</div>
              <div className='chart-item' onClick={this.changeClick}><img src={require('../pages/images/标签.png') }class="nameb"/>宠玩广场</div>
                {
                    this.state.ifChange ?<Charts/>:<News/>
                }
                
           </div>
        )
    }
}
export default Channe;
